package com.gxc.event;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

/**
 * 测试事件.
 *
 * @author 宫新程
 * @since 2019/1/25 11:05
 */
@Configuration
public class TestEvent {

  @Resource ApplicationContext applicationContext;

  /** PostConstruct. */
  @PostConstruct
  public void init() {
    MyEvent event = new MyEvent(this, "Hello World！");
    applicationContext.publishEvent(event);
    System.out.println("事件触发成功！");
  }
}
